home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / BomberBLaser.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.0 KB  |  67 lines

  1. class classes.shots.BomberBLaser
  2. {
  3.    var id;
  4.    var x;
  5.    var y;
  6.    var dir;
  7.    var l;
  8.    var xInc;
  9.    var clip;
  10.    var power = 45;
  11.    var c = 1;
  12.    var endMessageSent = false;
  13.    var Name = "bomberBLaser";
  14.    function BomberBLaser(px, py, pdir, pl, pid)
  15.    {
  16.       this.id = pid;
  17.       this.x = px;
  18.       this.y = py;
  19.       this.dir = pdir;
  20.       this.l = pl;
  21.       this.xInc = this.dir != "L" ? 30 : -30;
  22.       _root.d = _root.d + 1;
  23.       this.clip = _root.createEmptyMovieClip("bomberBLaser" + this.id + "Clip",_root.d);
  24.       this.clip._x = this.x;
  25.       this.clip._y = this.y;
  26.       _root.d = _root.d + 1;
  27.       this.clip.attachMovie("bomberBLaserSeg","bomberBLaserSeg1Clip" + this.id,_root.d);
  28.    }
  29.    function main()
  30.    {
  31.       this.c = this.c + 1;
  32.       if(this.x + (this.c - 1) * this.xInc < 1050 && this.x + (this.c - 1) * this.xInc > -50)
  33.       {
  34.          _root.d = _root.d + 1;
  35.          var _loc3_ = this.clip.attachMovie("bomberBLaserSeg","bomberBLaserSeg" + this.c + "Clip" + this.id,_root.d);
  36.          _loc3_._x = (this.c - 1) * this.xInc;
  37.          _loc3_.gotoAndStop(this.c);
  38.       }
  39.       else if(this.c < this.l)
  40.       {
  41.          this.l = this.c;
  42.       }
  43.       if(this.c > this.l)
  44.       {
  45.          if(!this.endMessageSent)
  46.          {
  47.             _root["bomberB" + this.id].stopLaserFire();
  48.             this.endMessageSent = true;
  49.          }
  50.          removeMovieClip(this.clip["bomberBLaserSeg" + (this.c - this.l) + "Clip" + this.id]);
  51.       }
  52.       if(_root["bomberB" + this.id].laser.firing)
  53.       {
  54.          this.clip._x = this.dir != "L" ? _root["bomberB" + this.id].x + 18 : _root["bomberB" + this.id].x - 30;
  55.          this.clip._y = _root["bomberB" + this.id].y - 3;
  56.       }
  57.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  58.       {
  59.          _root[_root.char].hit(this.xInc,0,100,this.power);
  60.       }
  61.       if(this.clip._width < 30)
  62.       {
  63.          _root.removeEnemyShot("bomberBLaser" + this.id);
  64.       }
  65.    }
  66. }
  67.